/**
 * Created with IntelliJ IDEA.
 * Description:
 * User: wangxin
 * Date: 2024-09-29
 * Time: 11:37
 */
public class test2 {
    public static int LIS (int[] arr) {
        // write code here
        int n = arr.length;

        // 一些特殊情况的处理
        if (0 == n) {
            return 0;
        }
        if (1 == n) {
            return 1;
        }

        int[] dp = new int[n];
        dp[0] = 1;
        int max = Integer.MIN_VALUE;

        for (int i = 1; i < n; i++) {
            dp[i] = 1;
            for (int j = 0; j < i; j++) {
                if (arr[j] < arr[i]) {
                    dp[i] = Math.max(dp[j] + 1, dp[i]);
                }
            }
            max = Math.max(max, dp[i]);
        }
        return max;
    }

    public static void main(String[] args) {
        int[] a = {6,3,1,5,2,3,7};
        int ret = LIS(a);
    }
}
